package cn.ibizlab.odoo.core.odoo_purchase.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Ipurchase_order_line;
import cn.ibizlab.odoo.core.odoo_purchase.domain.Purchase_order_line;
import cn.ibizlab.odoo.core.odoo_purchase.filter.Purchase_order_lineSearchContext;
import cn.ibizlab.odoo.core.odoo_purchase.service.IPurchase_order_lineService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[采购订单行] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Purchase_order_lineServiceImpl implements IPurchase_order_lineService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Ipurchase_order_lineClientService purchase_order_lineClientService;

    @Override
    public boolean create(Purchase_order_line purchase_order_line) {
        boolean bOk = false ;
        Ipurchase_order_line clientModel = this.convert2Model(purchase_order_line,null);
        purchase_order_lineClientService.create(clientModel) ;
        this.convert2Domain(clientModel,purchase_order_line);
        bOk = true ;

        return bOk ;
    }

    @Override
    public boolean update(Purchase_order_line purchase_order_line) {
        boolean bOk = false ;
        Ipurchase_order_line clientModel = this.convert2Model(purchase_order_line,null);
        purchase_order_lineClientService.update(clientModel) ;
        this.convert2Domain(clientModel,purchase_order_line) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public void updateBatch(List<Purchase_order_line> purchase_order_lines, int batchSize) {

        //purchase_order_lineClientService.updateBatch(purchase_order_lines,batchSize) ;

    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //purchase_order_lineClientService.removeBatch(purchase_order_lines) ;

    }

    @Override
    public Purchase_order_line get(Integer id) {
        Ipurchase_order_line clientModel = purchase_order_lineClientService.createModel();
        clientModel.setId(id);
        purchase_order_lineClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Purchase_order_line get(Purchase_order_line purchase_order_line) {
        Purchase_order_line retpurchase_order_line = this.get(purchase_order_line.getId()) ;
    	BeanCopier copier=BeanCopier.create(retpurchase_order_line.getClass(), purchase_order_line.getClass(), false);
        copier.copy(retpurchase_order_line, purchase_order_line, null);
        return purchase_order_line ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Ipurchase_order_line clientModel = purchase_order_lineClientService.createModel();
        clientModel.setId(id);
        purchase_order_lineClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void createBatch(List<Purchase_order_line> purchase_order_lines, int batchSize) {

                        //purchase_order_lineClientService.createBatch(purchase_order_lines,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Purchase_order_line> searchDefault(Purchase_order_lineSearchContext context) {
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据分析账户查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_account_analytic(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_product(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据采购订单查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_order(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_company(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据币种查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_currency(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_partner(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_create(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_write(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据销售订单行查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_sale_line(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据销售订单查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_sale_order(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据最小库存规则查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_orderpoint(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品计量单位查询
     */
    @Override
    public Page<Purchase_order_line> selectByOdoo_product_uom(Integer id){
        Purchase_order_lineSearchContext context = new Purchase_order_lineSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_order_line> list = new ArrayList<Purchase_order_line>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_order_line> clientModelList = purchase_order_lineClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_order_line clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_order_line>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Ipurchase_order_line convert2Model(Purchase_order_line domain , Ipurchase_order_line model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = purchase_order_lineClientService.createModel() ;
        }

         if(domain.getPrice_unitDirtyFlag())
            model.setPrice_unit(domain.getPrice_unit());
         if(domain.getQty_receivedDirtyFlag())
            model.setQty_received(domain.getQty_received());
         if(domain.getPrice_totalDirtyFlag())
            model.setPrice_total(domain.getPrice_total());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getProduct_qtyDirtyFlag())
            model.setProduct_qty(domain.getProduct_qty());
         if(domain.getPrice_taxDirtyFlag())
            model.setPrice_tax(domain.getPrice_tax());
         if(domain.getMove_idsDirtyFlag())
            model.setMove_ids(domain.getMove_ids());
         if(domain.getPrice_subtotalDirtyFlag())
            model.setPrice_subtotal(domain.getPrice_subtotal());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getSequenceDirtyFlag())
            model.setSequence(domain.getSequence());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getProduct_uom_qtyDirtyFlag())
            model.setProduct_uom_qty(domain.getProduct_uom_qty());
         if(domain.getTaxes_idDirtyFlag())
            model.setTaxes_id(domain.getTaxes_id());
         if(domain.getInvoice_linesDirtyFlag())
            model.setInvoice_lines(domain.getInvoice_lines());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getDate_plannedDirtyFlag())
            model.setDate_planned(domain.getDate_planned());
         if(domain.getQty_invoicedDirtyFlag())
            model.setQty_invoiced(domain.getQty_invoiced());
         if(domain.getAnalytic_tag_idsDirtyFlag())
            model.setAnalytic_tag_ids(domain.getAnalytic_tag_ids());
         if(domain.getMove_dest_idsDirtyFlag())
            model.setMove_dest_ids(domain.getMove_dest_ids());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getOrderpoint_id_textDirtyFlag())
            model.setOrderpoint_id_text(domain.getOrderpoint_id_text());
         if(domain.getSale_order_id_textDirtyFlag())
            model.setSale_order_id_text(domain.getSale_order_id_text());
         if(domain.getProduct_id_textDirtyFlag())
            model.setProduct_id_text(domain.getProduct_id_text());
         if(domain.getProduct_typeDirtyFlag())
            model.setProduct_type(domain.getProduct_type());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getAccount_analytic_id_textDirtyFlag())
            model.setAccount_analytic_id_text(domain.getAccount_analytic_id_text());
         if(domain.getProduct_imageDirtyFlag())
            model.setProduct_image(domain.getProduct_image());
         if(domain.getProduct_uom_textDirtyFlag())
            model.setProduct_uom_text(domain.getProduct_uom_text());
         if(domain.getOrder_id_textDirtyFlag())
            model.setOrder_id_text(domain.getOrder_id_text());
         if(domain.getCurrency_id_textDirtyFlag())
            model.setCurrency_id_text(domain.getCurrency_id_text());
         if(domain.getSale_line_id_textDirtyFlag())
            model.setSale_line_id_text(domain.getSale_line_id_text());
         if(domain.getDate_orderDirtyFlag())
            model.setDate_order(domain.getDate_order());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getAccount_analytic_idDirtyFlag())
            model.setAccount_analytic_id(domain.getAccount_analytic_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getSale_order_idDirtyFlag())
            model.setSale_order_id(domain.getSale_order_id());
         if(domain.getProduct_uomDirtyFlag())
            model.setProduct_uom(domain.getProduct_uom());
         if(domain.getSale_line_idDirtyFlag())
            model.setSale_line_id(domain.getSale_line_id());
         if(domain.getOrder_idDirtyFlag())
            model.setOrder_id(domain.getOrder_id());
         if(domain.getOrderpoint_idDirtyFlag())
            model.setOrderpoint_id(domain.getOrderpoint_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getProduct_idDirtyFlag())
            model.setProduct_id(domain.getProduct_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
        return model ;
    }

    public Purchase_order_line convert2Domain( Ipurchase_order_line model ,Purchase_order_line domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Purchase_order_line();
        }

        if(model.getPrice_unitDirtyFlag())
            domain.setPrice_unit(model.getPrice_unit());
        if(model.getQty_receivedDirtyFlag())
            domain.setQty_received(model.getQty_received());
        if(model.getPrice_totalDirtyFlag())
            domain.setPrice_total(model.getPrice_total());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getProduct_qtyDirtyFlag())
            domain.setProduct_qty(model.getProduct_qty());
        if(model.getPrice_taxDirtyFlag())
            domain.setPrice_tax(model.getPrice_tax());
        if(model.getMove_idsDirtyFlag())
            domain.setMove_ids(model.getMove_ids());
        if(model.getPrice_subtotalDirtyFlag())
            domain.setPrice_subtotal(model.getPrice_subtotal());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getSequenceDirtyFlag())
            domain.setSequence(model.getSequence());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getProduct_uom_qtyDirtyFlag())
            domain.setProduct_uom_qty(model.getProduct_uom_qty());
        if(model.getTaxes_idDirtyFlag())
            domain.setTaxes_id(model.getTaxes_id());
        if(model.getInvoice_linesDirtyFlag())
            domain.setInvoice_lines(model.getInvoice_lines());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getDate_plannedDirtyFlag())
            domain.setDate_planned(model.getDate_planned());
        if(model.getQty_invoicedDirtyFlag())
            domain.setQty_invoiced(model.getQty_invoiced());
        if(model.getAnalytic_tag_idsDirtyFlag())
            domain.setAnalytic_tag_ids(model.getAnalytic_tag_ids());
        if(model.getMove_dest_idsDirtyFlag())
            domain.setMove_dest_ids(model.getMove_dest_ids());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getOrderpoint_id_textDirtyFlag())
            domain.setOrderpoint_id_text(model.getOrderpoint_id_text());
        if(model.getSale_order_id_textDirtyFlag())
            domain.setSale_order_id_text(model.getSale_order_id_text());
        if(model.getProduct_id_textDirtyFlag())
            domain.setProduct_id_text(model.getProduct_id_text());
        if(model.getProduct_typeDirtyFlag())
            domain.setProduct_type(model.getProduct_type());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getAccount_analytic_id_textDirtyFlag())
            domain.setAccount_analytic_id_text(model.getAccount_analytic_id_text());
        if(model.getProduct_imageDirtyFlag())
            domain.setProduct_image(model.getProduct_image());
        if(model.getProduct_uom_textDirtyFlag())
            domain.setProduct_uom_text(model.getProduct_uom_text());
        if(model.getOrder_id_textDirtyFlag())
            domain.setOrder_id_text(model.getOrder_id_text());
        if(model.getCurrency_id_textDirtyFlag())
            domain.setCurrency_id_text(model.getCurrency_id_text());
        if(model.getSale_line_id_textDirtyFlag())
            domain.setSale_line_id_text(model.getSale_line_id_text());
        if(model.getDate_orderDirtyFlag())
            domain.setDate_order(model.getDate_order());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getAccount_analytic_idDirtyFlag())
            domain.setAccount_analytic_id(model.getAccount_analytic_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getSale_order_idDirtyFlag())
            domain.setSale_order_id(model.getSale_order_id());
        if(model.getProduct_uomDirtyFlag())
            domain.setProduct_uom(model.getProduct_uom());
        if(model.getSale_line_idDirtyFlag())
            domain.setSale_line_id(model.getSale_line_id());
        if(model.getOrder_idDirtyFlag())
            domain.setOrder_id(model.getOrder_id());
        if(model.getOrderpoint_idDirtyFlag())
            domain.setOrderpoint_id(model.getOrderpoint_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getProduct_idDirtyFlag())
            domain.setProduct_id(model.getProduct_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        return domain ;
    }


}
